<template>
<div>
  <p>用户名<input type="text" v-model='form.username'></p>
  <p>密码<input type="text" v-model='form.password'></p>
 <p>等级<input type="text" v-model="form.type2"></p>
  <button @click='login'>登录</button>
</div>
</template>

<script>
export default {
  name: "user_login",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    login(){
        this.$axios.post('users/login1/',this.form)
        .then(res=>{
          if(res.data.code==200){
            localStorage.setItem('userid',res.data.userid)
            localStorage.setItem('type',res.data.type)
            this.$router.push('/user_shop')
          }else {
            alert(res.data.meg)
          }
        })
    }
  }
}
</script>

<style scoped>

</style>
